<?php 
	class Main{
	
		private static $obj;
		protected $db_connect;
		
		private function __construct (){
				$link = mysql_connect ('localhost','root','3141592653');
				mysql_query("SET NAMES utf8");
				mysql_select_db ('test_db', $link) or die ('Can\'t connect:' .mysql_error().'</br>Error #:'. mysql_errno());
				$this -> db_connect = $link;
		}
		
		protected static function connect(){
			if (self::$obj === NULL){
				self::$obj = new Main();
			}
			return self::$obj->db_connect;
		}
	}
?>